import { Form, Input, Button, Checkbox } from 'antd';
import './register.less'
import http from '../../../utils/http';

function Register(){
    const onFinish = (values) => {
        console.log('Success:', values);
        let dataTime = new Date().getTime()
        console.log(dataTime);
        http({
            url: '/register',
            method:'post',
            data:{
                com_um : values.username,
                com_password : values.password,
                // Creation_time: dataTime 
                Creation_time:'2021-08-25 13:31:55'
            }
        }).then((res) => {
            console.log(res.data);
        })
    };

    const onFinishFailed = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };
    return (
        <div>
            <div>
            <Form
                name="basic"
                labelCol={{
                    span: 4,
                }}
                wrapperCol={{
                    span: 20,
                }}
                initialValues={{
                    remember: true,
                }}
                onFinish={onFinish}
                onFinishFailed={onFinishFailed}
            >
                <Form.Item
                    label="账号"
                    name="username"
                    rules={[
                        {
                            required: true,
                            message: '请输入账号',
                        },
                    ]}
                >
                    <Input />
                </Form.Item>

                <Form.Item
                    label="密码"
                    name="password"
                    rules={[
                        {
                            required: true,
                            message: '请输入密码',
                        },
                    ]}
                >
                    <Input.Password />
                </Form.Item>

                <Form.Item
                    wrapperCol={{
                        offset: 4,
                        span: 20,
                    }}
                >
                    <Button type="primary" htmlType="submit">
                        注册
                    </Button>
                </Form.Item>
            </Form>
        </div>
        </div>
    )
}
export default Register;